<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box {
      width: 200px;
      height: 200px;
      background-color: aquamarine;
    }
  </style>
</head>
<body>
  <div class="box"></div>
</body>
</html>

<script>
const box = document.querySelector('.box');
/* DOM0 事件绑定：只能绑定一个回调函数

  绑定事件
  box.onclick = function(event) {
    const e = window.event || event;
    console.log('click');
  }
  
  解绑事件
  box.onclick = null;
*/

/* DOM2
  const f = function(e) {
    console.log('callback function');
  }
  // 绑定事件
  box.addEventListener('type', f);

  // 解绑事件
  box.removeEventListener('type', f);
 */


</script>